<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>googlemap.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
	
	<script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("maps", "2");
      google.load("search", "1");
      
////////获得当前浏览者地理位置经纬度//////////
var x,y;
if (google.loader.ClientLocation != null) {
x = google.loader.ClientLocation.latitude;
y = google.loader.ClientLocation.longitude;
document.write("Your Location Is: " + google.loader.ClientLocation.latitude + "_" + google.loader.ClientLocation.longitude + "~~~~" + google.loader.ClientLocation.address.city + ", " + google.loader.ClientLocation.address.region);
} else {
document.write("Your Location Was Not Detected By Google Loader");
}
////////////////// 
      // Call this function when the page has been loaded
      function initialize() {
        var map = new google.maps.Map2(document.getElementById("map"));
        //map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 15);
        if(x!=undefined && y!=undefined)
			map.setCenter(new google.maps.LatLng(x, y), 12);
		else
			map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 15);
		
        var searchControl = new google.search.SearchControl();
        searchControl.addSearcher(new google.search.WebSearch());
        searchControl.addSearcher(new google.search.NewsSearch());
        searchControl.draw(document.getElementById("searchcontrol"));
      }
      google.setOnLoadCallback(initialize);
    </script>
  </head>
  
  <body>
    <div id="map" style="width: 400px; height: 200px"></div>
    <div id="searchcontrol"></div>
  </body>
</html>
